﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Functions/Messege/messege.master" AutoEventWireup="true" CodeBehind="ReceivedItems.aspx.cs" Inherits="HRDexCapstoneProject.Functions.Messege.WebForm1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainPage" runat="server">
    <div align="center">
    <asp:GridView ID="GridView1" runat="server" Width="389px" 
    style="text-align: center; margin-right: 4px;" onselectedindexchanged="GridView1_SelectedIndexChanged" 
            AutoGenerateColumns="False" DataSourceID="formMessege" 
            DataKeyNames="MessageID">
        <Columns>
            <asp:BoundField DataField="MessageID" HeaderText="MessageID" 
                InsertVisible="False" ReadOnly="True" SortExpression="MessageID" 
                Visible="False" />
            <asp:BoundField DataField="Subject" HeaderText="Subject" 
                SortExpression="Subject" />
            <asp:BoundField DataField="DateTime" HeaderText="DateTime" 
                SortExpression="DateTime" />
            <asp:BoundField DataField="AttachmentName" HeaderText="AttachmentName" 
                SortExpression="AttachmentName" />
            <asp:BoundField DataField="Parent" HeaderText="Parent" 
                SortExpression="Parent" />
            <asp:BoundField DataField="fulname" HeaderText="fulname" ReadOnly="True" 
                SortExpression="fulname" />
            <asp:BoundField DataField="catMessegeName" HeaderText="catMessegeName" 
                SortExpression="catMessegeName" />
            <asp:ButtonField CommandName="Select" HeaderText="View" Text="View" />

        </Columns>
</asp:GridView>
        <asp:SqlDataSource ID="formMessege" runat="server" 
            ConnectionString="<%$ ConnectionStrings:HRmainConnectionString %>" 
            
            
            
            
            
            SelectCommand="SELECT formMessegeSender.MessageID, formMessegeSender.Subject, formMessegeSender.DateTime, formMessegeSender.AttachmentName, formMessegeSender.Parent, formEmployees.LastName + ', ' + formEmployees.FirstName AS fulname, catMessege.catMessegeName FROM formMessegeSender INNER JOIN formEmployees ON formMessegeSender.EmployeeID = formEmployees.EmployeeID INNER JOIN catMessege ON formMessegeSender.catMessegeID = catMessege.catMessegeID WHERE (formMessegeSender.fromEmpID = @fromEmpID)">
            <SelectParameters>
                <asp:SessionParameter Name="fromEmpID" SessionField="EmployeeID" 
                    Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:HRmainConnectionString %>" 
            SelectCommand="SELECT formMessegeSender.Subject, formMessegeSender.Description, formMessegeSender.DateTime, formEmployees.LastName + ', ' + formEmployees.FirstName AS fulname, catMessege.catMessegeName, formMessegeSender.EmployeeID FROM formMessegeSender INNER JOIN formEmployees ON formMessegeSender.EmployeeID = formEmployees.EmployeeID INNER JOIN catMessege ON formMessegeSender.catMessegeID = catMessege.catMessegeID WHERE (formMessegeSender.MessageID = @msg)">
        </asp:SqlDataSource>
</div>
</asp:Content>
